import 'package:wanxiang_app/generated/json/base/json_convert_content.dart';
import 'package:wanxiang_app/bean/platform_entity.dart';

PlatformEntity $PlatformEntityFromJson(Map<String, dynamic> json) {
  final PlatformEntity platformEntity = PlatformEntity();
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    platformEntity.code = code;
  }
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    platformEntity.msg = msg;
  }
  final List<PlatformData>? data = (json['data'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<PlatformData>(e) as PlatformData).toList();
  if (data != null) {
    platformEntity.data = data;
  }
  return platformEntity;
}

Map<String, dynamic> $PlatformEntityToJson(PlatformEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['msg'] = entity.msg;
  data['data'] = entity.data.map((v) => v.toJson()).toList();
  return data;
}

extension PlatformEntityExtension on PlatformEntity {
  PlatformEntity copyWith({
    int? code,
    String? msg,
    List<PlatformData>? data,
  }) {
    return PlatformEntity()
      ..code = code ?? this.code
      ..msg = msg ?? this.msg
      ..data = data ?? this.data;
  }
}

PlatformData $PlatformDataFromJson(Map<String, dynamic> json) {
  final PlatformData platformData = PlatformData();
  final String? platformcode = jsonConvert.convert<String>(
      json['platformcode']);
  if (platformcode != null) {
    platformData.platformcode = platformcode;
  }
  final String? platform = jsonConvert.convert<String>(json['platform']);
  if (platform != null) {
    platformData.platform = platform;
  }
  return platformData;
}

Map<String, dynamic> $PlatformDataToJson(PlatformData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['platformcode'] = entity.platformcode;
  data['platform'] = entity.platform;
  return data;
}

extension PlatformDataExtension on PlatformData {
  PlatformData copyWith({
    String? platformcode,
    String? platform,
  }) {
    return PlatformData()
      ..platformcode = platformcode ?? this.platformcode
      ..platform = platform ?? this.platform;
  }
}